#ifndef H_TIMELINEBUTTON
#define H_TIMELINEBUTTON

#include "button.h"
#include "interpolationHelper.h"
#include "skeletalActor.h"
#include "action.h"
using namespace msbButton;

class TimelineButton: public  msbButton::Button{

public:

    vector <key*>   keyFrames;
    key*            selectedKey;

    // key dragging
    int             startPressedLeft;
    key*            draggedKey;

    InterpolationHelper    interpolator;

    SkeletalActor*  skeleton;
    bool bPlaying;
    bool bSkeletalTrack;
    float   timeScale;

    Action*         connectedAction;
    Actor*          connectedActor;

    TimelineButton();
    virtual ~TimelineButton();

    virtual void setup();
    virtual void update(double deltaTime);

    virtual void drawPlane();
    virtual void drawTimeScale();
    virtual void drawKeys();

    virtual void mouseOver();
    virtual void mouseDrag();
    virtual void clickedLeft();
    virtual void clickedRight();
    virtual void focusClick();

    virtual void playTimeline();
    virtual void pauseTimeline();

    virtual void deselect(int depth);
    virtual void create();

    virtual void setTimeScale( float tScale );
    virtual float convertToTimeGrid( float val );       //

    virtual bool isOccupied();                          // checks if key is occupying this place already

    virtual void deleteKey();                           // deletes selected keyFrames from timeline
    virtual void connectAction(Action* newAction);      // connects new action with timeline
    virtual void disconnectAction();                    // disconnects action
    virtual void updateAction();                        // updates connected actions so that changes to timeline occur in action
    virtual void populateFromAction(Action* other);     // replaces keyFrames of timeline and re-populates with keys from action


};
#endif // TIMELINEBUTTON
